#include <REGX52.H>
#include "Timer0.h"
#include "Key.h"
#include <INTRINS.H>


unsigned char Keynu,Ledmode;

void main()
{
    P2=0xFE;
    Timer0_Init();
	while(1)
	{
        Keynu=Key();
        if(Keynu==1)
        {
            Ledmode++;
            if (Ledmode>=2) Ledmode=0;
        }
		
	}
}

void Timer0_Routine() interrupt 1
{
    static unsigned int T0Count=0;
    TL0=0x18;
    TH0=0xFC;
    T0Count++;
    if (T0Count>30)
    {
        T0Count=0;
        if(Ledmode==0)
            P2=_crol_(P2,1);
        if(Ledmode==1)
            P2=_cror_(P2,1);
    }
    
}